package cn.laixueit.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(rollbackFor = RuntimeException.class)
public class UserService {


    @Autowired
    private JdbcTemplate jdbcTemplate;

    public void find(){

    }

    public void addUser(){
        System.out.println("针对java班级表操作");
        jdbcTemplate.update("insert into  card(cardid) values('12301230')");
        int i =1/0;
        jdbcTemplate.update("insert into student(username) values('张三')");
        System.out.println("针对java专业表操作");
    }


    public void del(){
        System.out.println("针对java班级表操作");
        jdbcTemplate.update("insert into  card(cardid) values('12301230')");
        int i =1/0;
        jdbcTemplate.update("insert into student(username) values('张三')");
        System.out.println("针对java专业表操作");
    }

}
